GBML manual / Tweens

tween_count

How many tweens are gliding right now, across the whole game.

Works differently on Game Boy - The Game Boy glides up to 8 variables at once (the Advance 16), in 32 steps of the curve, over a distance of less than 1,024; a ninth jumps to its end value as the Advance's does when its places are full.

Works differently on Game Boy Color - The Game Boy Color glides up to 8 variables at once (the Advance 16), in 32 steps of the curve, over a distance of less than 1,024; a ninth jumps to its end value as the Advance's does when its places are full.

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

tween_count() -> int

Returns

int

Description

How many glides are running right now, across the whole game.

Example

if (tween_count() < tween_max()) {
    tween_to(y, y - 32, 30, EASE_QUAD_OUT);
}

Starts a hop only while there is a free place for it, so the hop always glides instead of jumping. tween_max is how many there can ever be.

Good to know

On the GBA

Read it together with tween_max(), the way instance_count goes with instance_max: tween_max() - tween_count() is how many more can start before one has to jump instead of glide. A tween that ends (it arrived, was stopped, or its instance was destroyed) is counted out on the frame it ends. The debug overlay’s TWEENS row shows this number, the most there ever were, and the limit.

See also: tween_maxTweenstween_totween_stop